package com.hpeu_12.day1229;

public class Student {
	private String name;
	private int age;
	//生成get、set方法
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public int getAge() {
		return age;
	}
	public void setAge(int age) {
		this.age = age;
	}
	
	//编写无参构造器（构造方法）
	public Student() {
		System.out.println("执行了无参构造方法");
	}
	//生成有参构造器（构造方法）
	public Student(String name) {
		this();
		this.name = name;
		System.out.println("执行了参数为name的构造方法");
	}
	public Student(int age) {
		this();
		this.age = age;
		System.out.println("执行了参数为age的构造方法");
	}
	public Student(String name, int age) {
		this(name);
		this.name = name;
		this.age = age;
		System.out.println("执行了两个参数的构造方法");
	}
}
